package _18define;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo2 {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date();
        String format = sdf.format(date);
        System.out.println(format);

        String dateStr="2024-07-05 10:10:10";
        Date date1=sdf.parse(dateStr);
        System.out.println(date1);
    }
}
